﻿<UserControl xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  x:Class="MikeHole.TileMaker.TileMakerControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    xmlns:util="clr-namespace:Util"
    util:Clip.ToBounds="True"
    >
    
    
    
    
    <Grid x:Name="LayoutRoot" Background="Black">
        
        <Canvas x:Name="imageSource" HorizontalAlignment="Center" VerticalAlignment="Center" Width="173" Height="173">

        <Image x:Name="tileImage" Grid.Row="1" Grid.Column="1" RenderTransformOrigin="0.5,0.5" Width="173" Height="173">
            <Image.RenderTransform>
                <CompositeTransform x:Name="imagetransform"/>
            </Image.RenderTransform>
        </Image>

        </Canvas>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="173" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="173" />
                <RowDefinition />
            </Grid.RowDefinitions>
        
            <Rectangle Fill="Black" Opacity=".5" Grid.Column="0" Grid.RowSpan="3"/>
            <Rectangle Fill="Black" Opacity=".5" Grid.Column="2" Grid.RowSpan="3"/>
            <Rectangle Fill="Black" Opacity=".5" Grid.Column="1" Grid.Row="0"/>
            <Rectangle Fill="Black" Opacity=".5" Grid.Column="1" Grid.Row="2"/>

            <Border BorderBrush="White" BorderThickness="5" Margin="-5" Opacity=".8" Grid.Column="1" Grid.Row="1" />

        </Grid>

        <Border Width="173" Height="173" BorderBrush="Transparent" BorderThickness="5" Background="Transparent" RenderTransformOrigin="0.5,0.5">
            <Border.RenderTransform>
                <CompositeTransform x:Name="bordertransform"/>
            </Border.RenderTransform>
            <toolkit:GestureService.GestureListener>
                <toolkit:GestureListener 
                        Tap="GestureListener_Tap" 
                        DragStarted="GestureListener_DragStarted" DragDelta="GestureListener_DragDelta" DragCompleted="GestureListener_DragCompleted"
                        PinchStarted="GestureListener_PinchStarted" PinchDelta="GestureListener_PinchDelta" PinchCompleted="GestureListener_PinchCompleted"/>
            </toolkit:GestureService.GestureListener>
        </Border>
    </Grid>
</UserControl>
